const axios = require('axios').default;

axios.defaults.baseURL = 'http://47.96.154.185:3701';

// 导入全局定义好的 服务器地址
const baseUrl = require('./baseUrl.js');

axios.defaults.baseURL = baseUrl;

if (localStorage.getItem('token')) {
    let token = localStorage.getItem('token');
    axios.defaults.headers.common['Authorization'] = 'Bearer ' + token;
}

module.exports = axios;